11-Rounding up floating point numbers.py


Sign up Free. Don't forget to check out our challenges, lessons, solve and learn series and more ...


Code Snippet

#how to round up a floating point number to the nearest integer

x = 1.6
print (x)
x = round(x)
print (x)
#compare the above with
x = 1.6
x = int(x)
print (x)                    

Try it yourself